/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.manage.core.util.convertor;

import info.peigen.hotpot.manage.core.domain.Resource;
import info.peigen.hotpot.manage.core.repository.entity.ResourceEntity;
import info.peigen.hotpot.manage.core.service.order.ResourceCreateOrder;
import info.peigen.hotpot.manage.core.service.order.ResourceEditOrder;
import info.peigen.hotpot.manage.core.service.result.info.ResourceInfo;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * <b>(ResourceConvertor)</b>
 * "资源" 转换器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024-06-28
 */
@SuppressWarnings("unused")
@Mapper(builder = @Builder(disableBuilder = true))
public interface ResourceConvertor {
    ResourceConvertor INSTANCE = Mappers.getMapper(ResourceConvertor.class);

    // ConvertToEntity
    ResourceEntity convertToEntity(Resource domain);
    List<ResourceEntity> convertToEntitiesByDomain(List<Resource> domains);

    ResourceEntity convertToEntity(ResourceInfo resourceInfo);
    List<ResourceEntity> convertToEntitiesByInfo(List<ResourceInfo> resourceInfo);

    // ConvertToDomain
    Resource convertToDomain(ResourceEntity entity);
    List<Resource> convertToDomainsByEntity(List<ResourceEntity> entities);
    Resource convertToDomain(ResourceInfo resourceInfo);
    List<Resource> convertToDomainsByInfo(List<ResourceInfo> infos);

    Resource convertToDomain(ResourceCreateOrder order);
    Resource convertToDomain(ResourceEditOrder order);

    // ConvertToInfo
    ResourceInfo convertToInfo(Resource domain);
    List<ResourceInfo> convertToInfosByDomain(List<Resource> domains);

    ResourceInfo convertToInfo(ResourceEntity entity);
    List<ResourceInfo> convertToInfosByEntity(List<ResourceEntity> entities);
}